package net.huashitong.supervision.task.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import net.huashitong.supervision.task.entity.SMSLogEntity;
import net.huashitong.supervision.task.filter.SMSLogFilter;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/11/29
 * Time: 10:16
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Repository
public class SMSLogDao extends StringDao<SMSLogEntity> {
    public List<SMSLogEntity> queryBeforeDate(String pastDate) {
        GenericQuery obj = createQuery("obj");
//        obj.append(" and del is null");
        obj.append(" and createDate >:createDate").setParam("createDate", pastDate);
        obj.append(" and state =:state").setParam("state", "1");//发送成功的
        return obj.listResult();
    }

    public List<SMSLogEntity> queryLists(SMSLogFilter filter) {
        GenericQuery obj = createQuery("obj");
        obj.setOrder("sysId",GenericQuery.DESC);
//
        return obj.listResult(filter);
    }

}
